#include "capture_thread.h"

#include <QDebug>
capture_thread::capture_thread()
{
    if(VideoDeviceInit(VIDEO_DEV_NAME) < 0){
        qDebug() << "VideoDeviceInit failed!"<< endl;
    }
    else{
        qDebug() << "VideoDeviceInit success!"<< endl;
    }
    img = QImage(VIDEO_WIDTH, VIDEO_HEIGHT, QImage::Format_RGB888);
}

void capture_thread::run()
{
    while(1)
    {
        get_video_data((char* )img.bits());
        emit image_update(img);
    }
}
